<?php

require_once ('BaseAjaxModule.php');

class AdminModule extends BaseAjaxModule {
	
	public function preDispatch()	{
		$user = $this->getUser();
		if ($user == null)	{
			throw new Exception("Permission denied");
		}
		if ($user->role < 100)	{
			throw new Exception("Permission denied. Not Admin");
		}
	}
	
	public function addPlaceTask()	{
		$place = new Model_Place();
		$place->name = $this->getParam('name');
		$place->address = $this->getParam('address');
		$place->description = $this->getParam('description');
		$place->lat = $this->getParam('lat');
		$place->lng = $this->getParam('lng');
		$place->group_id = -1;
		$this->view->result = $place->add();
	}
}

?>